<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/global/global-head.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
	<title>吉车惠后台管理系统</title>
	<%@include file="/global/global-other.jsp" %>
	<script type="text/javascript">
		$(function() {
			setTabs();

			$("#main-navbar").bind("click",function(){
				$('.mainpage').layout('collapse','west');
			});

			$(".list-group-item").click(function(){
				$(".list-group-item").siblings().removeClass("on");
				$(this).addClass("on");
				var url=$(this).attr("url");
				var text=$(this).attr("txt");
				mainload(url,text);
			});

		})
	</script>
	<style type="text/css">
		.nav-right-menu-toggle{cursor: pointer;}
		.menus-user{color:#FFFFFF;height:105px;line-height: 105px;}
		.menus-user a{color:#FFFFFF;text-decoration: none;}
		.menus-user li{height:35px;line-height: 35px;padding-left:10px;cursor: pointer;}
		.menus-user li:HOVER{height:35px;line-height: 35px;background:#1caf9a}

		.nav-left-menu-toggle{cursor: pointer;}
		.nav-left-menu-toggle-active{background: #0568b4;}
	</style>
</head>
<body class="easyui-layout mainpage">
<!--[if lte IE 7]>
<div id="errorie"><div>您还在使用老掉牙的IE，正常使用系统前请升级您的浏览器到 IE8以上版本 <a target="_blank" href="http://windows.microsoft.com/zh-cn/internet-explorer/ie-8-worldwide-languages">点击升级</a>&nbsp;&nbsp;强烈建议您更改换浏览器：<a href="http://down.tech.sina.com.cn/content/40975.html" target="_blank">谷歌 Chrome</a></div></div>
<![endif]-->
<div data-options="region:'north',border:false,minHeight:85" class="navbar" style="overflow-y: hidden;">
	<div style="width:200px;height:70px;line-height:70px;float: left;" id="logo"></div>
	<div style="width:60%;height:70px;line-height:70px;float: left;" id="nav">
		<div style="float:left;margin-left:30px;">
			<ul class="nav navbars-left">
				<li onclick="index()" class="nav-left-menu-toggle nav-left-menu-toggle-active" style="float: left;text-align:center;width:85px;height:85px;margin-left:10px;text-align: ">
					<div style="width:85px;height: 60px;line-height:60px;padding-top:10px;"><i class="fa fa-home fa-3x" style="color:#FFFFFF;"></i></div>
					<div style="width:85px;height: 20px;line-height:20px;color:#FFFFFF;">首页</div>
				</li>
				<c:forEach var="li" items="${menusList}" >
					<c:if test="${li.pid=='0'}">
						<li onclick="mainload1('${ctx}/mainframe/index?pid=${li.id}');" class="nav-left-menu-toggle" style="float: left;text-align:center;width:85px;height:85px;margin-left:10px;text-align: ">
							<div class="${li.iconClsExt} fa-3x" style="width:85px;height: 60px;line-height:60px;padding-top:10px;color:#FFFFFF;"></div>
							<div style="width:85px;height: 20px;line-height:20px;color:#FFFFFF;">${li.text}</div>
						</li>
					</c:if>
				</c:forEach>
			</ul>
		</div>
	</div>
	<div style="width:25%;height:85px;line-height:85px;float: right;" id="out">
		<div style="float:right;margin-right:10px;">
			<ul class="nav navbars-right">
				<li id="msg" onclick="showMsg();" class="nav-right-menu-toggle" style="float: left;text-align:center;width:80px;height:85px;line-height: 85px;"><i class="fa fa-envelope fa-3x" style="color:#FFFFFF;margin-top:25px;"></i></li>
				<li style="float: left;height:85px;line-height: 85px;"><div style="border-left: 1px solid #6ab3ea;height:65px;line-height: 65px;margin-top:10px;"></div></li>
				<li id="userinfo" class="nav-right-menu-toggle" style="float: left;text-align:center;width:85px;height:85px;line-height: 85px;"><img src="${ctx}/assets/images/avatar-${session_admin_key.sex}-small.jpg" class="img-circle" style="width:40px;">&nbsp;<i class="fa fa-caret-down" style="color:#FFFFFF;"></i></li>
				<li style="float: left;height:85px;line-height: 85px;"><div style="border-left: 1px solid #6ab3ea;height:65px;line-height: 65px;margin-top:10px;"></div></li>
				<li id="help" onclick="help();" class="nav-right-menu-toggle" style="float: left;text-align:center;width:80px;height:85px;line-height: 85px;"><i class="fa fa-question-circle fa-3x" style="color:#FFFFFF;margin-top:25px;"></i></li>
				<li style="float: left;height:85px;line-height: 85px;"><div style="border-left: 1px solid #6ab3ea;height:65px;line-height: 65px;margin-top:10px;"></div></li>
				<li id="loginout" onclick="loginout();" class="nav-right-menu-toggle" style="float: left;text-align:center;width:80px;height:85px;line-height: 85px;"><i class="fa fa-power-off fa-3x" style="color:#ff6868;margin-top:25px;"></i></li>
			</ul>
		</div>
	</div>
</div>
<div data-options="region:'south',border:false" style="height:24px;background:#EBF7FD;">
	<div style="height:24px;line-height:24px;text-align:center;background: #efefef;">Copyright (c) 2015-* ******* Co. Ltd. * All right reserved.</div>
</div>
<div data-options="region:'center',border:false">
	<div class="easyui-tabs main-tab" data-options="height:'100%',width:'100%'"  id="main-tab">

	</div>
</div>
<div id="userinfo-temp" style="display: none;">
	<div style="padding:0px;margin:0px;background:#2b3034;width:130px;height:105px;">
		<ul class="menus-user">
			<li onclick="updateInfoView()">
				<a href="javascript:void(0)" >
					<i class="fa fa-user fa-lg" style="color:#43d1ff;"></i><span style="padding-left:10px;padding-bottom:3px;">个人信息</span>
				</a>
			</li>
			<li onclick="updatePswdView()">
				<a href="#">
					<i class="fa fa-key fa-lg" style="color:#ff8a00;"></i><span style="padding-left:6px;padding-bottom:3px;">密码修改</span>
				</a>
			</li>
			<li onclick="lockSystemView()">
				<a href="#">
					<i class="fa fa-lock fa-lg" style="color:red;"></i><span style="padding-left:10px;padding-bottom:3px;">锁定系统</span>
				</a>
			</li>
		</ul>
	</div>
</div>
<script type="text/javascript">
	var adminId="${session_admin_key.adminId}";
	var adminNo="${session_admin_key.account}";
	function setTabs(){
		$('#main-tab').tabs({
			plain:true,
			narrow: true,
			border:false,
		});

		$('#userinfo').tooltip({
			content: $('#userinfo-temp').html(),
			showEvent: 'click',
			onShow: function(){
				var t = $(this);
				t.tooltip('tip').css({"background":"#2b3034","border":"1px solid #000000"});
				t.tooltip('tip').unbind().bind('mouseenter', function(){
					t.tooltip('show');
				}).bind('mouseleave', function(){
					t.tooltip('hide');
				});
			}
		});

		$('#help').tooltip({
			position: 'bottom',
			content: '<div style="color:#fff;width:40px;text-align:center;">帮 助</div>',
			onShow: function(){
				$(this).tooltip('tip').css({
					backgroundColor: '#666',
					borderColor: '#666'
				});
			}
		});

		$('#loginout').tooltip({
			position: 'bottom',
			content: '<div style="color:#fff;width:40px;text-align:center;">退 出</div>',
			onShow: function(){
				$(this).tooltip('tip').css({
					backgroundColor: '#666',
					borderColor: '#666'
				});
			}
		});

		$(".navbars-left li").click(function(){
			$(".navbars-left li").removeClass("nav-left-menu-toggle-active");
			$(this).addClass("nav-left-menu-toggle-active");
		});

		mainload("${ctx}/welcome.jsp?");

	}

	function mainload(url){
		$(".tabs").hide();
		$(".tabs").css({"height":"0px;"});
		//$(".main-tab").css({"height":($(".main-tab").height())+"px"});

		$('#main-tab').tabs('close','2');//删除全局tab
		var tabs = $('#main-tab');
		var opts = {
			id:'2',
			title:"2",
			title:"mainFrame",
			closable : true,
			content : '<iframe class="iframe_" name="mainFrame" src="${ctx}'+ getUrl(url)+'" allowTransparency="true" style="border:0;width:100%;height:99.5%;" frameBorder="0" ></iframe>',
			border : false,
			fit : true
		};
		if (tabs.tabs('exists', opts.title)) {
			tabs.tabs('select', opts.title);
		} else {
			tabs.tabs('add', opts);
		}
	}

	function index(){
		//$.messager.alert("提示","暂无内容！");
		mainload("${ctx}/welcome.jsp?");
	}

	function mainload1(url){
		$(".tabs").hide();
		$(".tabs").css({"height":"0px;"});
		$('#main-tab').tabs('close','1');//删除全局tab
		$('#main-tab').tabs('add',{
			id:'1',
			title:"1",
			href: url+"&r="+Math.random(),
			closable: true,
			height: "auto",
			selected:true
		});

	}

	//个人信息
	var viewDialog;
	updateInfoView = function(){
		viewDialog = parent.$.dialog({
			title: '<i class="fa fa-th-large"></i><span class="dialog-title">&nbsp;个人信息<span>',
			href: '${ctx}/system/main/updatePersonnel?_m=init&r='+Math.random(),
			width: 800,
			height: 500,
			modal: true,
			onClose : function() {
				$(this).dialog('destroy');
			},
			buttons: [{
				text:'<i class="fa fa-floppy-o" aria-hidden="true"></i>&nbsp;保 存',
				width:'70px',
				handler: function(){
					viewDialog.find('iframe').get(0).contentWindow.submitForm(viewDialog);
				}
			},{
				text:'<i class="fa fa-reply" aria-hidden="true"></i>&nbsp;返 回',
				width:'70px',
				handler: function(){
					viewDialog.dialog('destroy');
				}
			}]
		});
	};

	//修改密码
	updatePswdView = function(){
		viewDialog = parent.$.dialog({
			title: '<i class="fa fa-th-large"></i><span class="dialog-title">&nbsp;密码修改<span>',
			href: '${ctx}/system/main/updatePassword?_m=init&r='+ Math.random(),
			width: 800,
			height: 400,
			modal: true,
			onClose : function() {
				$(this).dialog('destroy');
			},
			buttons: [{
				text:'<i class="fa fa-floppy-o" aria-hidden="true"></i>&nbsp;保 存',
				width:'70px',
				handler: function(){
					viewDialog.find('iframe').get(0).contentWindow.submitForm(viewDialog);
				}
			},{
				text:'<i class="fa fa-reply" aria-hidden="true"></i>&nbsp;返 回',
				width:'70px',
				handler: function(){
					viewDialog.dialog('destroy');
				}
			}]
		});
	};

	//系统锁定
	lockSystemView = function(){
		parent.$.messager.confirm('提示', '确定要锁定系统吗？', function (flag) {
			if (flag) {
				viewDialog = parent.$.dialog({
					closable: false,
					title: '<i class="fa fa-th-large"></i><span class="dialog-title">&nbsp;锁定系统<span>',
					href: '${ctx}/system/main/lock?_m=init&a='+adminNo+'&r='+Math.random(),
					width: 800,
					height: 150,
					modal: true,
					buttons: [{
						text: '登 录',
						width:'70px',
						handler: function(){
							viewDialog.find('iframe').get(0).contentWindow.submitForm(viewDialog);
						}
					},{
						text:'<i class="fa fa-reply" aria-hidden="true"></i>&nbsp;退 出',
						width:'70px',
						handler: function(){
							loginout();
						}
					}]
				});
			}
		});
	};

	showMsg = function(){
		viewDialog = parent.$.dialog({
			title: '<i class="fa fa-th-large"></i><span class="dialog-title">&nbsp;消息<span>',
			href: '${ctx}/bn/msg/search?_m=init&r='+Math.random(),
			width: 1000,
			height: 800,
			modal: true,
			onClose : function() {
				$(this).dialog('destroy');
			},
			buttons: [{
				text:'<i class="fa fa-floppy-o" aria-hidden="true"></i>&nbsp;查 看',
				width:'70px',
				handler: function(){
					viewDialog.find('iframe').get(0).contentWindow.submitForm(viewDialog);
				}
			},{
				text:'<i class="fa fa-reply" aria-hidden="true"></i>&nbsp;返 回',
				width:'70px',
				handler: function(){
					viewDialog.dialog('destroy');
				}
			}]
		});
	}

	loginout = function(){
		$.messager.confirm('提示', '确定要退出吗？', function (flag) {
			if (flag) {
				window.top.location='${ctx}/loginout?&r='+Math.random();
			}
		});
	};

	help = function(){
		$.messager.alert("提示","暂无帮助！");
	};
</script>

</body>
</html>
